package com.xydtech.workflow.service.impl;

import com.xydtech.common.core.text.Convert;
import com.xydtech.workflow.domain.WflFlownodeDefine;
import com.xydtech.workflow.mapper.WflFlownodeDefineMapper;
import com.xydtech.workflow.service.IWflFlownodeDefineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 流程节点定义Service业务层处理
 *
 * @author JHON
 * @date 2021-03-16
 */
@Service
public class WflFlownodeDefineServiceImpl implements IWflFlownodeDefineService {
    @Autowired
    private WflFlownodeDefineMapper wflFlownodeDefineMapper;

    /**
     * 查询流程节点定义
     *
     * @param stepId 流程节点定义ID
     * @return 流程节点定义
     */
    @Override
    public WflFlownodeDefine selectWflFlownodeDefineById(Long stepId) {
        return wflFlownodeDefineMapper.selectWflFlownodeDefineById(stepId);
    }

    /**
     * 查询流程节点定义列表
     *
     * @param wflFlownodeDefine 流程节点定义
     * @return 流程节点定义
     */
    @Override
    public List<WflFlownodeDefine> selectWflFlownodeDefineList(WflFlownodeDefine wflFlownodeDefine) {
        return wflFlownodeDefineMapper.selectWflFlownodeDefineList(wflFlownodeDefine);
    }

    /**
     * 查询流程未选的步骤 @Title: selectNoChoiceFlownodeByVersionId
     *
     * @param versionId
     * @return java.util.List<com.xydtech.workflow.domain.WflFlownodeDefine>
     * @exception
     * @author JHON @Date 2021/5/6 21:20
     */
    @Override
    public List<WflFlownodeDefine> selectNoChoiceFlownodeByVersionId(Long versionId) {
        return wflFlownodeDefineMapper.selectNoChoiceFlownodeByVersionId(versionId);
    }

    /**
     * 新增流程节点定义
     *
     * @param wflFlownodeDefine 流程节点定义
     * @return 结果
     */
    @Override
    public int insertWflFlownodeDefine(WflFlownodeDefine wflFlownodeDefine) {
        return wflFlownodeDefineMapper.insertWflFlownodeDefine(wflFlownodeDefine);
    }

    /**
     * 修改流程节点定义
     *
     * @param wflFlownodeDefine 流程节点定义
     * @return 结果
     */
    @Override
    public int updateWflFlownodeDefine(WflFlownodeDefine wflFlownodeDefine) {
        return wflFlownodeDefineMapper.updateWflFlownodeDefine(wflFlownodeDefine);
    }

    /**
     * 删除流程节点定义对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteWflFlownodeDefineByIds(String ids) {
        return wflFlownodeDefineMapper.deleteWflFlownodeDefineByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除流程节点定义信息
     *
     * @param stepId 流程节点定义ID
     * @return 结果
     */
    @Override
    public int deleteWflFlownodeDefineById(Long stepId) {
        return wflFlownodeDefineMapper.deleteWflFlownodeDefineById(stepId);
    }
}
